//
//  UIButton+Extension.swift
//  101weibo
//
//  Created by 劢克科技 on 2019/1/18.
//  Copyright © 2019 劢克科技. All rights reserved.
//

import UIKit

extension UIButton {
    /// 设置按钮的背景图片和图片
    ///
    /// - Parameters:
    ///   - imageName: 图片String
    ///   - bgImageName: 背景图片String
    convenience init(imageName: String, bgImageName: String) {
        self.init()
        setImage(UIImage(named: imageName), for: .normal)
        setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        setBackgroundImage(UIImage(named: bgImageName), for: .normal)
        setBackgroundImage(UIImage(named: bgImageName + "_highlighted"), for: .highlighted)
        sizeToFit()
    }
}
